﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShowActuals.aspx.cs" Inherits="Actuals.ShowActuals" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <link href="~/Actuals.css" rel="Stylesheet" type="text/css" />
    <link href="~/themes/ui-lightness/jquery.ui.all.css" rel="stylesheet" type="text/css" />
    <title></title>
    <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.ui.datepicker.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.ui.core.js") %>"></script>
    <script type="text/javascript">
        function showAddActuals() {
            var result = window.showModalDialog('AddActuals.aspx', this,
                'dialogHeight:700px;dialogWidth:400px;Status:yes;Toolbars:no;Scroll:yes;Help:no;Center:yes;');
            __doPostBack('refresh', 'refresh');
        }

        function ShowUpdateActuals(actualId) {
            var url = 'AddActuals.aspx?Mode=Edit&ActualId=' + actualId;//  + '&ProjectId=' + projectId + '&ReleaseId=' +  releaseId;
            var result = window.showModalDialog(url, this,
                'dialogHeight:700px;dialogWidth:400px;Status:yes;Toolbars:no;Scroll:yes;Help:no;Center:yes;');
            __doPostBack('refresh', 'refresh');
        }



        
      

        function TestCheckBox() {
            var Target = null;
            Target = document.getElementById('<%= this.gvResults.ClientID %>');
            if (Target == null) {
                alert("no record is selected.Please select!");
                return false;
            }
            var Inputs = Target.getElementsByTagName("input");

            for (var n = 0; n < Inputs.length; ++n) {
                if (Inputs[n].type == 'checkbox' && Inputs[n].checked) {
                    return confirm("Do you want to Delete");
                }


            }
            alert("no record is selected.Please select!");
            return false;
        }

   
        
    </script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#<%=txtFromDate.ClientID %>").datepicker({ dateFormat: 'mm-dd-yy', changeMonth: true, changeYear: true, yearRange: '2011:2013' });
            $("#<%=txtToDate.ClientID %>").datepicker({ dateFormat: 'mm-dd-yy', changeMonth: true, changeYear: true, yearRange: '2011:2013' });

        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <center>
        <div>
            <asp:Label ID="lblMsg" runat="server" CssClass="message"></asp:Label>
            <asp:Label ID="Label2" runat="server" CssClass="ParaTitle"> Actuals </asp:Label>
        </div>
        <div>
            <table>
                 <tr>
                            <td>
                                <asp:Label ID="lblProject" runat="server" CssClass="label">Project</asp:Label>
                            </td>
                            <td align="left">
                                <asp:DropDownList ID="ddlProject" runat="server" CssClass="textfield" AutoPostBack="true"
                                    OnSelectedIndexChanged="ddlProject_OnSelectedIndexChanged">
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblRelease" runat="server" CssClass="label">Release</asp:Label>
                            </td>
                            <td align="left">
                                <asp:DropDownList ID="ddlRelease" runat="server" CssClass="textfield ">
                                </asp:DropDownList>
                            </td>
                        </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label5" runat="server" CssClass="label"> From Date </asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtFromDate" CssClass="textfield" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label6" runat="server" CssClass="label"> To Date </asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtToDate" CssClass="textfield" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:CheckBox ID="chkShowMyActual" CssClass="label" runat="server" Text="Show All Actuals" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Button ID="btnGetActuals" CssClass="button" runat="server" Text="Get Actuals"
                            OnClick="btnGetActuals_Click" />
                             <asp:Button ID="Button1" CssClass="button" runat="server" Text="Export"
                            OnClick="btnExport_Click" />
                    </td>
                </tr>
            </table>
        </div>
        <div runat="server" id="divControls">
            <div id="divGrid" style="border: solid 1px silver; height: 450px; text-align: center;
                overflow-x: hidden; overflow-y: auto;">
                <asp:GridView ID="gvResults" AutoGenerateColumns="false" BorderColor="Black" runat="server"
                    AllowSorting="true" OnSorting="gvResults_Sorting" OnRowCommand="gvResults_OnRowCommand">
                    <HeaderStyle BackColor="White" Font-Size="10px" ForeColor="#990000" BorderStyle="None" />
                    <RowStyle BackColor="#F7F3F7" Font-Names="Verdana" Font-Size="XX-Small" BorderStyle="None" />
                    <AlternatingRowStyle BackColor="White" Font-Names="Verdana" Font-Size="XX-Small"
                        BorderStyle="None" />
                    <Columns>
                        <asp:TemplateField HeaderStyle-Width="5%" ItemStyle-Width="5%" ItemStyle-BorderStyle="None"
                            HeaderStyle-BorderStyle="None">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkShowActuals" runat="server" AutoPostBack="false" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField Visible="false">
                            <ItemTemplate>
                                <asp:Label ID="lblActualId" runat="server" Text='<%# Bind("ActualId") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField SortExpression="User" HeaderText="User">
                            <ItemTemplate>
                                <asp:Label ID="lblEmp" runat="server" Text='<%#Bind("nickname") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField SortExpression="date" HeaderText="Date">
                            <ItemTemplate>
                                <asp:Label ID="lblDate" runat="server" Text='<%# String.Format("{0:M/d/yyyy}",Eval("date")) %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Task">
                            <ItemTemplate>
                                <asp:Label ID="lblTask" runat="server" Text='<%#Bind("TaskShortName") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="SubTask">
                            <ItemTemplate>
                                <asp:Label ID="lblSubTask" runat="server" Text='<%# Bind("subtaskdesc")  %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Description">
                            <ItemTemplate>
                                <asp:Label ID="lblDescription" runat="server" Text='<%# Bind("Description") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="No Of Hours">
                            <ItemTemplate>
                                <asp:Label ID="lblNoOfHours" runat="server" Text='<%# Bind("NoOfHours") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderStyle-Width="5%" ItemStyle-Width="5%" ItemStyle-BorderStyle="None"
                            HeaderStyle-BorderStyle="None">
                            <ItemTemplate>
                                <asp:Button CausesValidation="false" CommandName="EditActual" runat="server" ID="btnEdit"
                                    Text="Edit" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ActualId") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>
            <div>
            <asp:Button ID="btnDelete" Text="Delete" runat="server" OnClientClick="return TestCheckBox()"
                OnClick="btnDeleteShowActuals_Click" />
            
                <asp:Button ID="btnAddActual" runat="server" CssClass="button" Text="AddActual" OnClientClick="return showAddActuals()" />
            </div>
        </div>
    </center>
    </form>
</body>
</html>
